import http from "@/utils/request.js";
import Qs from "qs";

export const apiLogin = (data) => {
	return http.request({
		url: '/auth/login',
		method: 'post',
		header: {
			isToken: false,
			isEncrypt: true,
		},
		data
	})
}

// 登录
export function phoneLogin(data) {
	return http.request({
		url: "/auth/loginByPhone",
		method: "post",
		header: {
			isToken: false,
			isEncrypt: true,
		},
		data: data,
	});
}

/**
 * 查询科普管理列表
 * @param query
 * @returns {*}
 */

export const listPopularize = (query) => {
	return http.request({
		url: '/system/popularize/list',
		method: 'get',
		params: query
	});
};

/**
 * 查询科普管理详细
 * @param id
 */
export const getPopularize = (id) => {
	return http.request({
		url: '/system/popularize/' + id,
		method: 'get'
	});
};

/**
 * 获取所有学校列表
 * @param query
 * @returns {*}
 */

export const optionSchool = (query) => {
	return http.request({
		url: '/system/dept/optionSchool',
		method: 'get',
		params: query
	});
};

/**
 * 获取所有练习题
 * @param id
 */
export const practiceList = () => {
	return http.request({
		url: '/system/question/practiceList',
		method: 'get'
	});
};

/**
 * 是否有题
 * @param id
 */
export const hasQuestion = () => {
	return http.request({
		url: '/system/question/hasQuestion',
		method: 'get'
	});
};

/**
 * 获取等级测试信息
 * @param id
 */
export const checkTestLevel = () => {
	return http.request({
		url: '/system/question/checkTestLevel',
		method: 'get'
	});
};

/**
 * 获取所有升级题
 * @param id
 */
export const testLevel = () => {
	return http.request({
		url: '/system/question/testLevel',
		method: 'get'
	});
};

/**
 * 获取所有练习数量
 * @param id
 */
export const getPracticeNum = () => {
	return http.request({
		url: '/system/question/getPracticeNum',
		method: 'get'
	});
};

/**
 * 新增/修改用户圈子分类
 * @param id
 */
export const editCircleCategory = (data) => {
	return http.request({
		url: '/system/user/editCircleCategory',
		method: 'post',
		data
	});
};

/**
 * 提交问题答案
 * @param id
 */
export const finishPractice = (data) => {
	return http.request({
		url: '/system/question/finishPractice',
		method: 'post',
		data
	});
};

/**
 * 提交升级答案
 * @param id
 */
export const finishTestLevel = (data) => {
	return http.request({
		url: '/system/question/finishTestLevel',
		method: 'post',
		data
	});
};


/**
 * 错题列表
 * @param id
 */
export const getIncorrect = (data) => {
	return http.request({
		url: '/system/question/getIncorrect',
		method: 'get',
		params: data
	});
};

/**
 * 历史列表
 * @param id
 */
export const getHistory = (data) => {
	return http.request({
		url: '/system/question/getHistory',
		method: 'get',
		params: data
	});
};

/**
 * 圈子列表
 * @param id
 */
export const circleList = (data) => {
	return http.request({
		url: '/system/circle/list',
		method: 'get',
		params: data
	});
};
/**
 * 我的圈子
 * @param id
 */
export const circlemyList = (data) => {
	return http.request({
		url: '/system/circle/myList',
		method: 'get',
		params: data
	});
};


/**
 * 全部科普筛选
 * @param id
 */
export const getCircleByUserId = (data) => {
	return http.request({
		url: '/system/user/getCircleByUserId',
		method: 'get',
		params: data
	});
};

/**
 * 新增圈子
 * @param data
 */
export const addCircle = (data) => {
	return http.request({
		url: '/system/circle',
		method: 'post',
		data: data
	});
};

/**
 * 圈子详情
 * @param data
 */
export const circleId = (id) => {
	return http.request({
		url: '/system/circle/' + id,
		method: 'get',
	});
};


/**
 * 我的积分
 * @param id
 */
export const pointsList = (data) => {
	return http.request({
		url: '/system/points/list',
		method: 'get',
		params: data
	});
};
/**
 * 新增圈子收藏
 * @param data
 */
export const collectAdd = (data) => {
	return http.request({
		url: '/system/collect/add',
		method: 'post',
		data: data
	});
};
/**
 * 新增科普收藏
 * @param data
 */
export const addCollectByPopularize = (data) => {
	return http.request({
		url: '/system/collect/addCollectByPopularize',
		method: 'post',
		data: data
	});
};
/**
 * 删除收藏
 * @param data
 */
export const collectDelete = (data) => {
	return http.request({
		url: '/system/collect/delete',
		method: 'post',
		data: data
	});
};
/**
 * 我的收藏
 * @param id
 */
export const collectList = (data) => {
	return http.request({
		url: '/system/collect/list',
		method: 'get',
		params: data
	});
};
/**
 * ai
 * @param id
 */
export const callWithMessage = (data) => {
	return http.request({
		url: '/system/tongYi/callWithMessage',
		method: 'post',
		data: data
	});
};

/**
 * 修改个人信息
 * @param id
 */
export const updateUserInfo = (data) => {
	return http.request({
		url: '/system/user/profile/updateUserInfo',
		method: 'post',
		data: data
	});
};
/**
 * 修改个人信息
 * @param id
 */
export const getLearningSituation = (data) => {
	return http.request({
		url: '/system/question/getLearningSituation',
		method: 'get',
		data: data
	});
};
/**
 * 成为会员
 * @param id
 */
export const openVip = (data) => {
	return http.request({
		url: '/system/vipOrder/openVip',
		method: 'post',
		data: data
	});
};
/**
 * 查看我的纠错
 * @param id
 */
export const errormyList = (data) => {
	return http.request({
		url: '/system/djjError/myList',
		method: 'get',
		data: data
	});
};
/**
 * 我要纠错
 * @param id
 */
export const djjError = (data) => {
	return http.request({
		url: '/system/djjError',
		method: 'post',
		data: data
	});
};
/**
 * 下载列表
 * @param id
 */
export const downloadList = (data) => {
	return http.request({
		url: '/system/download/list',
		method: 'get',
		data: data
	});
};
/**
 * 所属等级
 * @param id
 */
export const listUserLevel = (query) => {
	return http.request({
		url: '/system/userLevel/list',
		method: 'get',
		params: query
	});
};

/**
 * 新增答题信息
 * @param data
 */
export const addQuestion = (data) => {
	return http.request({
		url: '/system/question/addByStudent',
		method: 'post',
		data: data
	});
};

/**
 * 查询答题信息列表
 * @param data
 */
export const questionmyList = (data) => {
	return http.request({
		url: '/system/question/myList',
		method: 'get',
		params: data
	});
};


/**
 * 活动报名
 * @param data
 */
export const activitylist = (data) => {
	return http.request({
		url: '/system/activity/list',
		method: 'get',
		params: data
	});
};

/**
 * 活动报名详情
 * @param data
 */
export const activitylistId = (id) => {
	return http.request({
		url: '/system/activity/' + id,
		method: 'get',
	});
};

/**
 * 消息
 * @param data
 */
export const noticeList = (params) => {
	return http.request({
		url: '/system/notice/list',
		method: 'get',
		params
	});
};
/**
 * 消息详情
 * @param data
 */
export const noticeId = (id) => {
	return http.request({
		url: '/system/notice/' + id,
		method: 'get',
	});
};
/**
 * 新增活动报名
 * @param data
 */
export const activityOrder = (data) => {
	return http.request({
		url: '/system/activityOrder',
		method: 'post',
		data: data
	});
};

/**
 * 新增圈子回复
 * @param data
 */
export const addCircleReply = (data) => {
	return http.request({
		url: '/system/circleReply',
		method: 'post',
		data: data
	});
};

/**
 * 查询竞赛管理列表
 * @param query
 * @returns {*}
 */

export const listCompetition = (query) => {
	return http.request({
		url: '/system/competition/list',
		method: 'get',
		params: query
	});
};

/**
 * 报名
 * @param data
 */
export const competitionApply = (data) => {
	return http.request({
		url: '/system/competition/apply',
		method: 'post',
		data: data
	});
};

/**
 * 我的竞赛
 * @param data
 */
export const competitionjoined = (data) => {
	return http.request({
		url: '/system/competition/joined',
		method: 'get',
		params: data
	});
};

/**
 * 我的 竞赛开始考试入口
 * @param data
 */
export const competitionnotStart = (data) => {
	return http.request({
		url: '/system/competition/notStart',
		method: 'get',
		params: data
	});
};

/**
 * 我的 开始竞赛
 * @param data
 */
export const competitionnStart = (data) => {
	return http.request({
		url: '/system/competition/start',
		method: 'post',
		data: data
	});
};
/**
 * 我的 开始竞赛 提交答案
 * @param data
 */
export const competitionnFinish = (data) => {
	return http.request({
		url: '/system/competition/finish',
		method: 'post',
		data: data
	});
};
/**
 * 竞赛详情
 * @param data
 */
export const competitionId = (id) => {
	return http.request({
		url: '/system/competition/' + id,
		method: 'get',
	});
};
/**
 * 我的 我的点亮
 * @param data
 */
export const myLight = (data) => {
	return http.request({
		url: '/system/user/myLight',
		method: 'get',
		params: data
	});
};

/**
 * 我的 更改头像
 * @param data
 */
export const updateAvatarImage = (data) => {
	return http.request({
		url: '/system/user/profile/updateAvatarImage',
		method: 'post',
		data: data
	});
};
/**
 * 查询商城配置列表
 * @param query
 * @returns {*}
 */

export const listMallConfig = (query) => {
	return http.request({
		url: '/system/mallConfig/vueList',
		method: 'get',
		params: query
	});
};

/**
 * 查询商品管理列表
 * @param query
 * @returns {*}
 */

export const mallProductList = (query) => {
	return http.request({
		url: '/system/mallProduct/vueList',
		method: 'get',
		params: query
	});
};


/**
 * 查询商品管理详细
 * @param id
 */
export const getMallProduct = (id) => {
	return http.request({
		url: '/system/mallProduct/' + id,
		method: 'get'
	});
};

/**
 * 查询我的订单
 * @param query
 * @returns {*}
 */

export const mallRecordMyList = (query) => {
	return http.request({
		url: '/system/mallRecord/myList',
		method: 'get',
		params: query
	});
};

/**
 * 修改订单管理
 * @param data
 */
export const updateMallRecord = (data) => {
	return http.request({
		url: '/system/mallRecord',
		method: 'put',
		data: data
	});
};

/**
 * 查询我的地址
 * @param query
 * @returns {*}
 */

export const userAddrMylist = (query) => {
	return http.request({
		url: '/system/userAddr/myList',
		method: 'get',
		params: query
	});
};

/**
 * 新增用户收货地址
 * @param data
 */
export const addUserAddr = (data) => {
	return http.request({
		url: '/system/userAddr',
		method: 'post',
		data: data
	});
};

/**
 * 修改用户收货地址
 * @param data
 */
export const updateUserAddr = (data) => {
	return http.request({
		url: '/system/userAddr',
		method: 'put',
		data: data
	});
};

/**
 * 删除用户收货地址
 * @param id
 */
export const delUserAddr = (id) => {
	return http.request({
		url: '/system/userAddr/' + id,
		method: 'delete'
	});
};

/**
 * 查询PK配置列表
 * @param query
 * @returns {*}
 */

export const listPk = (query) => {
	return http.request({
		url: '/system/pk/list',
		method: 'get',
		params: query
	});
};

/**
 *  购买商品
 * @param data
 */
export const buyGoods = (data) => {
	return http.request({
		url: '/system/mallRecord/buyGoods',
		method: 'post',
		data: data
	});
};


/**
 *  获取pk个人信息
 * @param data
 */
export const winRate = (data) => {
	return http.request({
		url: '/system/pkRecord/winRate',
		method: 'get',
		data: data
	});
};

/** 根据code获取openid
 * @param data
 */
export const decodeOpenid = (data) => {
	return http.request({
		url: '/system/wxPay/decodeOpenid',
		method: 'get',
		params: data
	});
};

/** 发起支付
 * @param data
 */
export const payOrder = (data) => {
	return http.request({
		url: '/system/wxPay/payOrder',
		method: 'post',
		data: data
	});
};

/** 发起支付
 * @param data
 */
export const createOrderForApp = (data) => {
	return http.request({
		url: 'system/wxPay/createOrderForApp',
		method: 'post',
		data: data
	});
};

/** 升级资格
 * @param data
 */
export const hasUpgradeQuestion = (data) => {
	return http.request({
		url: '/system/question/hasUpgradeQuestion',
		method: 'get',
		params: data
	});
};

/** 升级资格
 * @param data
 */
export const upgradeList = (data) => {
	return http.request({
		url: '/system/question/upgradeList',
		method: 'get',
		params: data
	});
};

/**
 * 提交升级答案
 * @param id
 */
export const upgradeAnswer = (data) => {
	return http.request({
		url: '/system/question/upgradeAnswer',
		method: 'post',
		data
	});
};


/** 获取token
 * @param data
 */
export const getAliTtsSts = (data) => {
	return http.request({
		url: '/system/client/getAliTtsSts',
		method: 'get',
		params: data
	});
};




















// 获取供应商信息
export function getSupplierList(data) {
	return http.request({
		url: "/basic/hmSupplier/list",
		method: "get",
		data,
	});
}
//获取合同信息 供销 破价 保证金
export function getContractList(data) {
	return http.request({
		url: "/basic/contract/list",
		method: "get",
		data,
	});
}
// 获取合同信息详细信息
export function getcontract(data) {
	return http.request({
		url: "/basic/contract/" + data,
		method: "get",
		data,
	});
}

// * 查询商品列表
export function listSupplierAddProduct(data) {
	return http.request({
		url: "/supplier/hmProducts/list",
		method: "post",
		params: data,
	});
}
// 查询商品详细
export function getSupplierAddProducts(data) {
	return http.request({
		url: "/supplier/hmProducts/" + data,
		method: "get",
		data,
	});
}
// 查询供应商增类列表
export function hmSupplierList(data) {
	return http.request({
		url: "/basic/hmSupplier/list",
		method: "get",
		data,
	});
}

// 查询OSS对象基于id串
export function listByIds(data) {
	return http.request({
		url: "/resource/oss/listByIds/" + data,
		method: "get",
		data,
	});
}
//查询品牌列表
export function listBrand(data) {
	return http.request({
		url: "/basic/brand/list",
		method: "get",
		data,
	});
}
// 获取品牌详细信息
export function getbrandId(data) {
	return http.request({
		url: "/basic/brand/" + data,
		method: "get",
		data,
	});
}
// 查询供应商列表
export function hmSupplierMyList(data) {
	return http.request({
		url: "/basic/hmSupplier/my/list",
		method: "get",
		data,
	});
}

// 根据字典类型查询字典数据信息
export function getDicts(data) {
	return http.request({
		url: "/system/dict/data/type/" + data,
		method: "get",
		data,
	});
}
//类目：根据父级代码获取子类
export function getproductscategorychildlistbypid(data) {
	return http.request({
		url: "/basic/productsCategory/getproductscategorychildlistbypid",
		method: "get",
		data,
	});
}
// 新增商品提报
export function addHmProducts(data) {
	return http.request({
		url: "/supplier/hmProducts",
		method: "post",
		data,
	});
}
//获取所有主播
export function getAnchorList(data) {
	return http.request({
		url: "/system/user/list",
		method: "get",
		data,
	});
}
//修改商品状态为已到样
export function editTwo(data) {
	return http.request({
		url: "/basic/hmProducts/editTwo",
		method: "get",
		data,
	});
}
// 修改商品为待上架
export function editFour(data) {
	return http.request({
		url: "/basic/hmProducts/editFour",
		method: "get",
		data,
	});
}
// 修改商品为已上架
export function editFive(data) {
	return http.request({
		url: "/basic/hmProducts/editFive",
		method: "get",
		data,
	});
}
// 修改商品为下架
export function editOff(data) {
	return http.request({
		url: "/basic/hmProducts/editOff?ids=" + data,
		method: "get",
		data,
	});
}

export function editCore(data) {
	return http.request({
		url: "/basic/hmProducts/core",
		method: "post",
		data,
	});
}
//修改商品为待审核
export function editSeven(data) {
	return http.request({
		url: "/basic/hmProducts/editSeven",
		method: "get",
		data,
	});
}
// 新增品牌
export function addBrand(data) {
	return http.request({
		url: "/basic/brand",
		method: "post",
		data,
	});
}
//查询品牌列表
export function getbrandList(data) {
	return http.request({
		url: "/basic/brand/list",
		method: "get",
		data,
	});
}
export function editHmProducts(data) {
	return http.request({
		url: "/basic/hmProducts",
		method: "put",
		data,
	});
}
//修改品牌
export function updatebrand(data) {
	return http.request({
		url: "/basic/brand",
		method: "put",
		data,
	});
}
//修改账号信息
export function updateHmSupplier(data) {
	return http.request({
		url: "/basic/hmSupplier",
		method: "put",
		data,
	});
}

// 新增供应商账号
export function addHmSuppliers(data) {
	return http.request({
		url: "/system/add",
		method: "post",
		data,
	});
}

// 获取供应商信息
export function getSupplierId(data) {
	return http.request({
		url: "/supplier/getInfo",
		method: "post",
		data
	});
}

// 获取部门列表
export function getDeptList(data) {
	return http.request({
		url: "/supplier/passer/list",
		method: "post",
		params: data,
	});
}
//获取部门下的所有用户信息
export function getUserList(data) {
	return http.request({
		url: "/supplier/passer/getUserList",
		method: "post",
		params: data,
	});
}

//商品编辑详细
export function hmSupplierDeail(data) {
	return http.request({
		url: "/basic/hmSupplier/list",
		method: "get",
		data,
	});
}

// 修改商品为已邮寄中状态
export function editOne(data) {
	return http.request({
		url: "/supplier/hmProducts/editOne",
		method: "post",
		data,
	});
}

export function getSupplierIdByToken(data) {
	return http.request({
		url: "/basic/hmSupplier/getSupplierIdByToken",
		method: "post",
		data,
	});
}

// 获取验证码
export function getPhoneCode(data) {
	return http.request({
		url: "/system/sms/sendCode",
		method: "post",
		params: data,
	});
}

// 找回密码发送手机验证码
export function findPasswordCode(data) {
	return http.request({
		url: "/system/findPasswordCode",
		method: "post",
		params: data,
	});
}

// 找回密码手机验证码验证
export function findPasswordCheckCode(data) {
	return http.request({
		url: "/system/findPasswordCheckCode",
		method: "post",
		params: data,
	});
}

// 手机号找回密码
export function resetUserPwd(data) {
	return http.request({
		url: "/system/resetUserPwd",
		method: "post",
		params: data,
	});
}

// 修改密码
export function updatePassword(data) {
	return http.request({
		url: "/system/updatePassword",
		method: "post",
		params: data,
	});
}

// 隐私政策
export function listNotice(data) {
	return http.request({
		url: "/system/notice/list",
		method: "get",
		params: data,
	});
}

// 解析手机号
export function encrypt(data) {
	return http.request({
		url: "/system/phoneNumber",
		method: "post",
		params: data,
	});
}

// 获取用户详细信息
export const getInfo = () => {
	return http.request({
		url: "/system/user/getInfo",
		method: "get",
	});
};

// 添加商品获取招商部
export const getSupplier = () => {
	return http.request({
		url: "/supplier/getSupplier",
		method: "post"
	});
};

// 添加商品获取招商员
export const getUserById = (data) => {
	return http.request({
		url: "/supplier/getUserById",
		method: "post",
		params: data,
	});
};

/**
 * 类目根据id查询pid
 * @param data
 * @returns
 */
export const getListById = (data) => {
	return http.request({
		url: "/basic/productsCategory/getListById",
		method: "post",
		data: data,
	});
};

// 查询商品类目-改造后
export const categoryList = (data) => {
	return http.request({
		url: "/basic/category/list",
		method: "post",
		data,
	});
};

// 发货方式
export const hmExpress = () => {
	return http.request({
		url: "/system/dict/data/type/hm_express",
		method: "get",
	});
};

// 请求oss配置
export const getAliOssSts = () => {
	return http.request({
		url: "/system/client/getAliOssSts",
		method: "get",
	});
};

/**
 * 快递信息识别
 * @param data
 */
export const getDeliveryInfo = (data) => {
	return http.request({
		url: '/basic/delivery/getDeliveryInfo',
		method: 'post',
		data: data,
	});
};

/**
 * 进入随机匹配
 * @param data
 */
export const pollingRandomMatch = (data) => {
	return http.request({
		url: '/system/pkCode/pollingRandomMatch',
		method: 'get',
	});
};

/**
 * 抢题
 * @param data
 */
export const robQuestion = (data) => {
	return http.request({
		url: '/system/pkRecord/robQuestion',
		method: 'post',
		data: data,
	});
};

/**
 * 提交pk答案
 * @param id
 */
export const submitAnswer = (data) => {
	return http.request({
		url: '/system/pkRecord/submitAnswer',
		method: 'post',
		data
	});
};

// 注销
export const cancel = (data) => {
	return http.request({
		url: "/system/user/cancelAccount",
		method: "get",
	});
};

/**
 *  获取pk对手个人信息
 * @param data
 */
export const getPkInfo = (data) => {
	return http.request({
		url: '/system/pkRecord/getPkInfo',
		method: 'post',
		data: data
	});
};

/**
 *  获取pk结果
 * @param data
 */
export const getResult = (data) => {
	return http.request({
		url: '/system/pkRecord/getResult',
		method: 'post',
		data: data
	});
};

/**
 * 新增投诉举报
 * @param data
 */
export const addFeedback = (data) => {
  return http.request({
    url: '/system/feedback',
    method: 'post',
    data: data
  });
};

/**
 * 查询客户服务列表
 * @param query
 * @returns {*}
 */

export const listPhone = (query) => {
  return http.request({
    url: '/system/phone/list',
    method: 'get',
    params: query
  });
};
/**
 * 查询图片配置详细
 * @param id
 */
export const getImageConfig = () => {
  return http.request({
    url: '/system/imageConfig/1',
    method: 'get'
  });
};